package com.fengsir.exp4;

import com.fengsir.exp4.entity.Student;
import com.fengsir.exp4.mapper.StudentMapper;
import com.fengsir.exp4.mybatisUtil.MybatisUtil;
import org.apache.ibatis.session.SqlSession;

/**
 * @author fengzeng
 * @create 2021/4/20 14:04
 */
public class MybatisApplication {


  public static void main(String[] args) {
    Student student = new Student(1003,"张三","male",95);
    SqlSession sqlSession = MybatisUtil.getSqlSessionFactory().openSession();
    StudentMapper studentMapper = sqlSession.getMapper(StudentMapper.class);
    studentMapper.insert(student);
    Student student1 = studentMapper.selectStudent(1003);
    System.out.println("name: " + student1.getName());
    System.out.println("score: " + student1.getScore());
    sqlSession.close();
  }
}
